<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<c:set var="webroot" value="${pageContext.request.contextPath}" />
<html lang="en">
<head>
<script type="text/javascript" src="${webroot}/static/js/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="${webroot}/static/js/bootstrap.min.js"></script>
<script type="text/javascript" src="${webroot}/static/js/jquery.validate.min.js"></script>
<script type="text/javascript" src="${webroot}/static/js/messages_zh.js"></script>
<script type="text/javascript"
	src="${webroot}/static/js/app-common-2.00.0.js"></script>
<script type="text/javascript" src="${webroot}/static/js/layer/layer.js"></script>
<script src="${webroot}/static/js/jquery.form.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css"
	href="${webroot}/static/js/layer/skin/layer.css" />
<link rel="stylesheet" type="text/css"
	href="${webroot}/static/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css"
	href="${webroot}/static/css/bootstrap-table.min.css" />
<link rel="stylesheet" type="text/css"
	href="${webroot}/static/css/bootstrapValidator.css" />
<link rel="stylesheet" href="${webroot}/static/css/topdiv.css"/>
<style type="text/css">
.control-group {
	width: 60%;
	margin-top: 30px;
}

.labs {
	width: 120px;
	text-align: right;
	display: table-cell;
	vertical-align: middle;
}

.control {
	display: table-cell;
	padding-left: 3px;
}

.control-input {
	width: 185px;
	background-color: #0000ff03;
	border: none;
}

.control-button {
	float: right;
	padding-right: 120px;
	padding-top: 10px;
}

.control-button-input {
	float: right;
	position: relative;
	top: -34px;
	right: 25px;
	width: 85px;
	height: 30px;
}

.control-button-input1 {
	background-color: #b96146;
	border-color: #b96146;
	color: aliceblue;
	width: 60px;
	height: 28px;
	border-radius: 8px;
}

.control-button-input2 {
	background-color: #03A9F4;
	border-color: #03A9F4;
	color: aliceblue;
	width: 100px;
	height: 31px;
	border-radius: 8px;
}
.error{
    color:#dd2222;
}
.layui-btn {
    display: inline-block;
    height: 38px;
    line-height: 38px;
    padding: 0 18px;
    background-color: #009688;
    color: #fff;
    white-space: nowrap;
    text-align: center;
    font-size: 14px;
    border: none;
    border-radius: 2px;
    cursor: pointer;
}
.layui-btn-normal {
    background-color: #1E9FFF;
    width: 95px;
}
.layui-btn-primary {
    border: 1px solid #C9C9C9;
    background-color: #fff;
    color: #555;
    width: 85px;
}
</style>
</head>
<body>
	<div style="padding-top: 10px;">
		<div class="bread">
			<ul><li> 当前位置&nbsp;:</li><li>投诉建议列表</li>&gt;<li>投诉建议详情</li></ul>
		</div>
		<form class="order-form" id="filterForm">
		  <input type="hidden" id="id" name="id" value="${feedback.id}" />
			<div class="control-group">
				<label class="labs">建议类别:</label>
				<div class="control">
					<input type="text" class="control-input" id="type"
						name="type" disabled="disabled" value="${feedback.type}">
				</div>
			</div>
			<div class="control-group">
				<label class="labs">昵称:</label>
				<div class="control">
					<input type="text" class="control-input" disabled="disabled" id="nickname" name="nickname" value="${feedback.nickname}">
				</div>
			</div>
			<div class="control-group">
				<label class="labs">姓名:</label>
				<div class="control">
					<input type="text" class="control-input" id="name"
						name="name" disabled="disabled" value="${feedback.name}">
				</div>
			</div>
			<div class="control-group">
				<label class="labs">手机号:</label>
				<div class="control">
					<input type="text" class="control-input" id="phone"
						name="phone" disabled="disabled" value="${feedback.phone}">
				</div>
			</div>
			<div class="control-group">
				<label class="labs">建议时间:</label>
				<div class="control">
					<input type="text" class="control-input" id="createdAt"
						name="createdAt" disabled="disabled" value="<fmt:formatDate value="${feedback.createdAt}" pattern=" yyyy-MM-dd  HH:mm:ss"/>">
				</div>
			</div>
		    <div class="control-group">
				<label class="labs">图片:</label>
				<div class="control">
				    <c:if test="${feedback.pictureList != ''}">
				          <c:forEach items="${feedback.pictureList}" var="p">
				              <img src="${p.picture}" style="width: 115px; height: 115px;">
				          </c:forEach>
				    </c:if>
				</div>
			</div>
			<div class="control-group">
				<label class="labs">建议内容:</label>
				<div class="control">
					<input type="text" class="control-input" id="content"
						name="content" disabled="disabled" value="${feedback.content}">
				</div>
			</div>
			<div class="control-group">
				<label class="labs">状态:</label>
				<div class="control">
					<select id="status" name="status" style="width: 185px; height: 26px;">
					<c:if test="${feedback.status==1}">
					   <option selected="selected" value="1">被采纳</option>
					   <option value="2">未被采纳</option>
					</c:if>
					<c:if test="${feedback.status==2}">
					   <option value="1">被采纳</option>
					   <option selected="selected" value="2">未被采纳</option>
					</c:if>
					<c:if test="${feedback.status==0}">
					   <option value="0">未处理</option>
					   <option value="1">被采纳</option>
					   <option value="2">未被采纳</option>
					</c:if>
					</select>
				</div>
			</div>
			<div class="control-group">
				<label class="labs">回复内容:</label>
				<div class="control">
				    <textarea id="remark" name="remark" style="width: 500px;height: 200px;background-color: #faf4f4;">${feedback.remark}</textarea>
				</div>
			</div>
		</form>
		<div style="padding-left: 160px; padding-top: 30px;">
				<input type="button" class="layui-btn layui-btn-normal" id="saveId" onclick="save();" value="保存" />
				&nbsp;&nbsp;<input type="button" class="layui-btn layui-btn-primary" onclick="cole();" value="返回" />
		</div>
	</div>
</body>
<script type="text/javascript">
$(function () {
	var isa = ('${status}');
	if(isa == "null"){
		$("#saveId").hide();
		$("#status").attr("disabled","disabled");
		$("#remark").attr("disabled","disabled");
	}
	 $('#filterForm').validate({
		 debug: true,
		 onkeyup: null,
		 rules: {
			 userName : {
				 required:true
			 },
			 userId : {
				 required:true
			 },
			 password : {
				 required:true
			 }
		 }
	 })
	
})

//确认
function save(){
	if($('#status option:selected').val() == ''){
		return;
	}
	var isFeedback = '';
	if($('#remark').val()!= '' ){
		isFeedback = '1';
	}
	var url='${webroot}/feedback/update';
	$.ajax({
		url : url,
		type : "POST",
		data : {
			"id" : $('#id').val(),
			"remark" : $('#remark').val(),
			"type" : $('#type').val(),
			"status" : $('#status option:selected').val(),
			isFeedback : isFeedback
		},
		dataType : "json",
		async : false,
		cache : false,
		success : function(obj) {
			if (obj != null) {
				layer.msg("操作成功");
				setTimeout(function () {location.href = "${webroot}/feedback/showlist?id=${resourceId}";},2000);
			}else{
				layer.msg("操作失败");
			}
		}
	});
}

function cole(){
	window.location.href = '${webroot}/feedback/showlist?id=${resourceId}';
}
</script>
</html>